﻿#region Using Directives
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.Design;
using Pharmacy.Entities;
using Pharmacy.Data;
using Pharmacy.Data.Bases;
#endregion

namespace Pharmacy.Web.Data
{
	/// <summary>
	/// Represents the DataRepository.ViewRequiredAdjustmentProvider object that provides
	/// data to data-bound controls in multi-tier Web application architectures.
	/// </summary>
	[CLSCompliant(true)]
	[Designer(typeof(ViewRequiredAdjustmentDataSourceDesigner))]
	public class ViewRequiredAdjustmentDataSource : ReadOnlyDataSource<ViewRequiredAdjustment>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the ViewRequiredAdjustmentDataSource class.
		/// </summary>
		public ViewRequiredAdjustmentDataSource() : base(DataRepository.ViewRequiredAdjustmentProvider)
		{
		}

		#endregion Constructors
		
		#region Properties
		
		/// <summary>
		/// Gets a reference to the ViewRequiredAdjustmentDataSourceView used by the ViewRequiredAdjustmentDataSource.
		/// </summary>
		protected ViewRequiredAdjustmentDataSourceView ViewRequiredAdjustmentView
		{
			get { return ( View as ViewRequiredAdjustmentDataSourceView ); }
		}
		
		#endregion Properties
		
		#region Methods

		/// <summary>
		/// Creates a new instance of the ViewRequiredAdjustmentDataSourceView class that is to be
		/// used by the ViewRequiredAdjustmentDataSource.
		/// </summary>
		/// <returns>An instance of the ViewRequiredAdjustmentDataSourceView class.</returns>
		protected override BaseDataSourceView<ViewRequiredAdjustment, Object> GetNewDataSourceView()
		{
			return new ViewRequiredAdjustmentDataSourceView(this, DefaultViewName);
		}
		
		/// <summary>
        /// Creates a cache hashing key based on the startIndex, pageSize and the SelectMethod being used.
        /// </summary>
        /// <param name="startIndex">The current start row index.</param>
        /// <param name="pageSize">The current page size.</param>
        /// <returns>A string that can be used as a key for caching purposes.</returns>
		protected override string CacheHashKey(int startIndex, int pageSize)
        {
			return String.Format("{0}:{1}:{2}", SelectMethod, startIndex, pageSize);
        }
		
		#endregion Methods
	}
	
	/// <summary>
	/// Supports the ViewRequiredAdjustmentDataSource control and provides an interface for
	/// data-bound controls to perform data operations with business and data objects.
	/// </summary>
	public class ViewRequiredAdjustmentDataSourceView : ReadOnlyDataSourceView<ViewRequiredAdjustment>
	{
		#region Declarations

		#endregion Declarations
		
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the ViewRequiredAdjustmentDataSourceView class.
		/// </summary>
		/// <param name="owner">A reference to the ViewRequiredAdjustmentDataSource which created this instance.</param>
		/// <param name="viewName">The name of the view.</param>
		public ViewRequiredAdjustmentDataSourceView(ViewRequiredAdjustmentDataSource owner, String viewName)
			: base(owner, viewName)
		{
		}
		
		#endregion Constructors
		
		#region Properties

		/// <summary>
		/// Gets a strongly-typed reference to the Owner property.
		/// </summary>
		internal ViewRequiredAdjustmentDataSource ViewRequiredAdjustmentOwner
		{
			get { return Owner as ViewRequiredAdjustmentDataSource; }
		}

		/// <summary>
		/// Gets a strongly typed reference to the Provider property.
		/// </summary>
		internal ViewRequiredAdjustmentProviderBase ViewRequiredAdjustmentProvider
		{
			get { return Provider as ViewRequiredAdjustmentProviderBase; }
		}

		#endregion Properties
		
		#region Methods
		
		#endregion Methods
	}

	#region ViewRequiredAdjustmentDataSourceDesigner

	/// <summary>
	/// Provides design-time support in a design host for the ViewRequiredAdjustmentDataSource class.
	/// </summary>
	public class ViewRequiredAdjustmentDataSourceDesigner : ReadOnlyDataSourceDesigner<ViewRequiredAdjustment>
	{
	}

	#endregion ViewRequiredAdjustmentDataSourceDesigner

	#region ViewRequiredAdjustmentFilter

	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilter&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="ViewRequiredAdjustment"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class ViewRequiredAdjustmentFilter : SqlFilter<ViewRequiredAdjustmentColumn>
	{
	}

	#endregion ViewRequiredAdjustmentFilter

	#region ViewRequiredAdjustmentExpressionBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlExpressionBuilder&lt;EntityColumn&gt;"/> class
	/// that is used exclusively with a <see cref="ViewRequiredAdjustment"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class ViewRequiredAdjustmentExpressionBuilder : SqlExpressionBuilder<ViewRequiredAdjustmentColumn>
	{
	}
	
	#endregion ViewRequiredAdjustmentExpressionBuilder		
}

